//
//  BaseViewController.m
//  dmao-customer
//
//  Created by macbook on 2017/10/16.
//  Copyright © 2017年 秦慕乔. All rights reserved.
//

#import "BaseViewController.h"

#define LEFTEDGEINSET UIEdgeInsetsMake(0, -50, -17, 0);
#define RIGHREDGEINSET UIEdgeInsetsMake(0, 0, -20, -25);

@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self createNavigationItem];
}

-(void)createNavigationItem
{
    self.navigationController.navigationBarHidden = YES;
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self.view addSubview:({
        _backgView = [[UIView alloc] initWithFrame:CGRectMake(0, 20, WIDTH, 50)];
        _backgView.userInteractionEnabled = YES;
        _backgView.backgroundColor = [UIColor colorWithHex:0xff3539];
        _backgView;
    })];
    
    [self.view addSubview:({
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.font = [UIFont systemFontOfSize:18];
        _titleLabel.frame = CGRectMake(0, 35, WIDTH, 20);
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.textColor = [UIColor colorWithHex:0xf0f0f0];
        _titleLabel;
    })];
    
    [_backgView addSubview:({
        _backImg = [[UIImageView alloc] initWithFrame:CGRectMake(15, 15, 18, 18)];
        [_backImg setImage:[UIImage imageNamed:@"Login_back"]];
        _backImg;
    })];
    
    [_backgView addSubview:({
        _leftBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _leftBtn.frame = CGRectMake(5, 5, 40, 40);
        [_leftBtn addTarget:self action:@selector(returnBack) forControlEvents:(UIControlEventTouchUpInside)];
        _leftBtn;
    })];
    
    [_backgView addSubview:({
        _rightBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _rightBtn.frame = CGRectMake(WIDTH-70, 5, 60, 40);
        _rightBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        [_rightBtn setTitleColor:[UIColor colorWithHex:0xf0f0f0] forState:UIControlStateNormal];
        [_rightBtn addTarget:self action:@selector(rightBtnClick) forControlEvents:(UIControlEventTouchUpInside)];
        _rightBtn;
    })];
}


-(void)returnBack
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)rightBtnClick
{
    
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
